package com.sxj.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * 2024年07月23日 13:43
 */
public class Person implements CompareInterface<Person> {
    private String name;
    private Integer age;

    public Person() {
    }

    public Person(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public int compareTo(Person person) {
        if (this.age > person.getAge()) {
            return 1;
        } else if (this.age < person.getAge()) {
            return -1;
        }
        return 0;
    }
}
